﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="DeliverGoodsManagement_InvoiceDetails" Codebehind="InvoiceDetails.aspx.cs" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ Register Src="../Controls/ORDERNOTEListControl.ascx" TagName="ORDERNOTEListControl"
    TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
<style type="text/css">
body {margin:0; padding:0;font-size:12px;}
a.lj {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:link {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:visited {font-size:12px; color:#ff9900; text-decoration:underline;}
a.lj:hover {color:#ff3300;}
a.lj:active {color:#ff3300;}
.input_button {width:52px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt.gif) no-repeat;}
.input_button1 {width:74px;height:23px;border:none;cursor:pointer; background:#ffffff url(../Include/Images/bt1.gif) no-repeat;}
.juli {margin-top:10px;padding-left:20px;}
.menu_bg { background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 1px solid;}
.tb {width:800px;background-color:#999999;}
.tb1 {background-color:#999999;}
.tb3 {width:1050px;background-color:#999999;}
.tb4 {width:1000px;background-color:#999999;}
.z1{background-color:#e7e7e7; text-align:left; line-height:20px;}
.z2{background-color:#FFFFFF; text-align:left; line-height:20px;}
.zt3 {text-align:center; font-weight:600; color:#000000;}
.zt4 {text-align:center; color:#000000;}
.zt5 {text-align:left; font-weight:600;}
.zt7 {text-align:right; color:#000000;}
.kuandu {width:30px; text-align:right;}
.kuandu1 {width:60px; text-align:right;}
.bk_left {border-bottom:#999999 1px solid;border-right:#999999 1px solid;border-left:#999999 1px solid;border-top:#999999 0px solid;}
.bk_middle {border-bottom:#999999 1px solid;border-right:#999999 1px solid;border-left:#999999 0px solid;border-top:#999999 0px solid;}
h2 {width:100%;padding-left:20px;padding-top:10px;margin:0; background: url(../Include/Images/menu_title.gif) repeat-x;height:21px;font-size:14px; font-weight:600;}
.menu_bg { background-color:#fef3bb; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cf994b 1px solid;width:100%;clear:left;}
.menu_bg1 { background-color:#f5f5f5; padding-left:20px;padding-top:6px; padding-bottom:6px;border-bottom:#cccccc 1px solid;border-top:#cccccc 1px solid;width:100%;clear:left;}
.menu_bg2 {width:100%;background-color:#cccccc;text-align:left;margin:10px 0 10px 0;padding-top:5px;border:#CCCCCC 0px solid; font-size:12px;padding-left:20px;}
.menu_bg3 {width:100%;background-color:#cccccc;text-align:left;margin:10px 0 10px 0;padding-top:5px;padding-bottom:5px;border:#CCCCCC 0px solid; font-size:12px;padding-left:20px;}
.btlj {background: url(../Include/Images/bt1.gif) no-repeat; width:74px; height:23px;text-align:center; padding-top:5px; font-size:12px;float:left;margin-left:5px;display:inline;}
.btlj a{color:#000000; text-decoration:none;}
.btlj a:hover{color:#FF3300;text-decoration:underline;}
.jiacu {float:left; font-weight:bold;padding-top:5px;}
.hidden{visibility:hidden;}
.modalPopup {
	background-color:#ffffdd;
	border-width:3px;
	border-style:solid;
	border-color:#bdbdbd;
	padding:3px;
	width:250px;
}
.modalBackground {
	background-color:Gray;
	filter:alpha(opacity=70);
	opacity:0.7;
}
.divbackground
{
z-index:9;display:none;position:absolute;width:1120px;height:1040px;left:0px;top:0px;background-color:#8C8C8C;opacity: 0.5;filter:alpha(opacity=50,finishopacity=50,style=1);}
</style>
<script type="text/javascript" src="../Include/Js/SocanCode.js"></script>
<script type="text/javascript">
    function IsCreateNewOrder()
    {
        //alert("aaaaa");
        if(confirm('确定要生成差异订单吗？'))
        { 
            document.getElementById('IsCreateNewOrder').value=1; 
        } 
        else
        {
            document.getElementById('IsCreateNewOrder').value=0;
        }
    }

       
       function Deliver()
       {
            var quantity = document.getElementById("hidQty").value;
            var qtyArray = quantity.split("|");
            
            if(qtyArray.length>0)
            {
            
                 var str = "";
                
                for(var i=2;i<qtyArray.length+2-1;i++)
                {
                    if(i<10)
                    {
                        var strName = "grvInvoiceDetail_ctl0" + i + "_txtQty";
                        var ctl = document.getElementById(strName);
                        if(ctl!=null)
                        {
                            if(ctl.value==0)
                            {
                                alert("请填写正确的数字！数量必须大于0！");
                                return;
                            }
                            str = str + ctl.value + "|";
                        }
                        
                        
                    }
                    else
                    {
                        var strName = "grvInvoiceDetail_ctl" + i + "_txtQty";
                        var ctl = document.getElementById(strName);
                        if(ctl!=null)
                        {
                            if(ctl.value==0)
                            {
                                alert("请填写正确的数字！数量必须大于0！");
                                return;
                            }
                            str = str + ctl.value + "|";
                        }
                    }
                    
                }
                
                
                if(str==quantity)
                {
                    
                }
                else
                {
                    if(confirm('要生成差异订单吗？'))
                    {
                        document.getElementById("hid").value="1";
                    }
                    else
                    {
                        document.getElementById("hid").value="0";
                    }
                }
                
            }
       }
       function OpenOrderWindow(link)
       {
           
           var url = "../Order/OrderDetail.aspx?code=" + link.title;
           window.open(url);
       }
       
       function SetFocus()
       {
           var text = document.getElementById("dlistMainInvoice_ctl00_txtDeliverCode");
           text.focus();
       }
      function Mask()
        {
            var div_back = document.getElementById("div_background");
            div_back.style.display = "block"; 
        }

        function HidMask()
        {
            var div_back = document.getElementById("div_background");
            div_back.style.display = "none";    
        }
</script>
</head>
<body onload="SetFocus()">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <h2>发货单明细</h2>
        <div align="Justify">
            <div class="menu_bg">
            <asp:Button ID="btnLock" runat="server" CssClass="input_button1" Text="锁定" OnClick="btnLock_Click"  />
            <asp:Button ID="btnUnlock" runat="server" CssClass="input_button1" Text="解锁" OnClick="btnUnlock_Click" />
            <asp:Button ID="btnSave" runat="server" CssClass="input_button1" Text="保存更改" OnClientClick="Deliver()" OnClick="btnSave_Click" />&nbsp;
            <asp:Button ID="btnDeliver" CssClass="input_button" runat="server" Text="发货" OnClick="btnDeliver_Click" />&nbsp;
            <asp:Button ID="btnUpdateDeliverInfo" runat="server" Text="保存物流信息" CssClass="input_button3" OnClick="btnUpdateDeliverInfo_Click" />
            <asp:Button ID="btnDeliverPrint" CssClass="input_button1" runat="server" Text="打印配货单" OnClick="btnDeliverPrint_Click" />&nbsp;
            <asp:Button ID="btnExpressPrint" CssClass="input_button1" runat="server" Text="打印物流单" OnClick="btnExpressPrint_Click" />&nbsp;
            物流单打印模板：<asp:DropDownList ID="dropExpressBill" runat="server">
            </asp:DropDownList>
                <asp:Button ID="btnHiddenShip" runat="server" Text="Button" CssClass="hidden" OnClick="btnHiddenShip_Click" />&nbsp;
            
                
                <input id="hidQty" runat="Server" type="hidden" />
                <input id="IsCreateNewOrder" runat="server" type="hidden" />
                <input id="hid" runat="server" type="hidden" value="2" />
                </div>
            <div class="juli">
            <asp:DataList ID="dlistMainInvoice" runat="server" OnItemDataBound="dlistMainInvoice_ItemDataBound">
                <ItemTemplate>
                    <table class="tb" border="0" cellspacing="1" cellpadding="0">
                        <tr class="z2">
                            <td class="zt5" width="120">
                                订单编号：

                            </td>
                            <td width="260">
                                <a href="#" class="lj" title='<%# Eval("ORDER_ID")%>' onclick="OpenOrderWindow(this)">
                                    <%# Eval("ORDER_ID")%>
                                </a>
                            </td>
                            <td class="zt5" width="120">
                                使用积分：

                            </td>
                            <td>
                                <%#  String.Format("{0:0.00}", Eval("ORDER_ITG"))%>
                            </td>
                            <td class="zt5" width="120">
                                用户账户：

                            </td>
                            <td>
                                <%--<%# Eval("CustomerCode")%>--%>
                                <a class="lj" href='../CustomerArchives/CustomerArchiveDetail.aspx?code=<%# Eval("CustomerCode")%>'>
                                    <%# Eval("CustomerCode")%>
                                </a>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5" width="120">
                                用户真实姓名：

                            </td>
                            <td>
                                <%# Eval("CustomerName")%>
                            </td>
                            <td class="zt5">
                                用户昵称：

                            </td>
                            <td>
                                <%# Eval("BYZD5")%>
                            </td>
                            <td class="zt5">
                                已结算金额：
                            </td>
                            <td>
                                <%#  String.Format("{0:0.00}",Eval("ORDER_CLEARAMT"))%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5" width="120">
                                收货人：
                            </td>
                            <td>
                                <%# Eval("ORDER_GETER")%>
                            </td>
                            <td class="zt5">
                                联系电话：

                            </td>
                            <td>
                                <%# Eval("ORDER_GETERPHONE1")%>
                                &nbsp;&nbsp;&nbsp;<%# Eval("ORDER_GETERPHONE2")%>
                            </td>
                            <td class="zt5" width="120">
                                总重量：
                            </td>
                            <td>
                                <%#  String.Format("{0:0}", Eval("ORDER_WEIGHT"))%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                物流单打印：
                            </td>
                            <td>
                                <asp:CheckBox ID="CheckBox2" runat="server" Enabled="false" Checked='<%# Eval("TPRINTCOUNT").ToString()!="0"?true:false%>' />
                            </td>
                            <td class="zt5" width="120">
                                订单来源：

                            </td>
                            <td>
                                <%# Eval("OF_NAME")%>
                            </td>
                            <td class="zt5">
                                物流单打印次数：
                            </td>
                            <td>
                                <%# Eval("TPRINTCOUNT")%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5" width="120">
                                费用性质：

                            </td>
                            <td>
                                <%# Convert.ToString(Eval("ORDER_COSTNATURE")) == "001" ? "我方承担" : "会员承担"%>
                            </td>
                            <td class="zt5">
                                配货单打印：
                            </td>
                            <td>
                                <asp:CheckBox ID="CheckBox3" runat="server" Enabled="false" Checked='<%# Eval("PRINTCOUNT").ToString()!="0"?true:false%>' />
                            </td>
                            <td class="zt5" width="120">
                                物流公司：

                            </td>
                            <td>
                                <input id="hidTranerCode" type="hidden" runat="server" value='<%# Eval("ORDER_TRANERCODE")%>' />
                                <asp:DropDownList ID="dropTraner" runat="server">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                配货单打印次数：
                            </td>
                            <td>
                                <%# Eval("PRINTCOUNT")%>
                            </td>
                            <td class="zt5">
                                物流单号：

                            </td>
                            <td>
                                <input id="txtDeliverCode" runat="server" type="text" value='<%# Eval("ORDER_TRANBILLCODE")%>' />
                                <%--onkeypress="PressEnterKeyEvent(this)" --%>
                            </td>
                            <td class="zt5">
                                批次号：
                            </td>
                            <td>
                                <asp:Label ID="lblPCH" runat="server" Text='<%# Eval("BYZD21") %>'></asp:Label>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                发货：

                            </td>
                            <td>
                                <asp:CheckBox ID="CheckBox4" runat="server" Enabled="false" Checked='<%# Eval("ORDER_SEND").ToString()!="0"?true:false%>' />
                            </td>
                            <td class="zt5">
                                发货人:
                            </td>
                            <td>
                                <%#Eval("ORDER_SENDER")%>
                            </td>
                            <td class="zt5">
                                发货时间
                            </td>
                            <td>
                                <%#Eval("ORDER_SENDDATE")%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                发货锁定：

                            </td>
                            <td>
                                <asp:CheckBox ID="CheckBox6" runat="server" Enabled="false" Checked='<%# Eval("BYZD13").ToString()=="1"?true:false%>' />
                            </td>
                            <td class="zt5">
                                发货锁定人:
                            </td>
                            <td>
                                <%#Eval("BYZD20")%>
                            </td>
                            <td class="zt5">
                                发货锁定时间
                            </td>
                            <td>
                                <%#Eval("BYZD10")%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                物流费用：

                            </td>
                            <td>
                                <%--<asp:TextBox ID="txtTranCost" runat="server" Text='<%# String.Format("{0:0.00}",Eval("ORDER_TRANCOST"))%>'></asp:TextBox>--%>
                                <asp:Label ID="lblTranCost" runat="server" Text='<%# String.Format("{0:0.00}",Eval("ORDER_TRANCOST"))%>'></asp:Label>
                            </td>
                            <td class="zt5">
                                担保交易：

                            </td>
                            <td>
                                <asp:CheckBox ID="CheckBox5" runat="server" Enabled="false" Checked='<%# Eval("ORDER_SECDEAL").ToString()!="0"?true:false%>' />
                            </td>
                            <td class="zt5" width="120">
                                折扣：

                            </td>
                            <td>
                                <%#  String.Format("{0:0.00}", Eval("ORDER_DISC"))%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                货到付款：

                            </td>
                            <td>
                                <asp:CheckBox ID="chkPayAfterReceive" runat="server" Enabled="false" Checked='<%# Eval("ORDER_APAY").ToString()!="0"?true:false%>' />
                            </td>
                            <td class="zt5" width="120">
                                商品金额：

                            </td>
                            <td>
                                <%#  String.Format("{0:0.00}", Eval("ORDER_AMT"))%>
                            </td>
                            <td class="zt5">
                                需要发票：
                            </td>
                            <td>
                                <asp:CheckBox ID="CheckBox1" runat="server" Enabled="false" Checked='<%# Eval("ORDER_NINV").ToString()!="0"?true:false%>' />
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                让利金额：

                            </td>
                            <td>
                                <%--<asp:TextBox ID="txtOfferAMT" runat="server" Text='<%#  String.Format("{0:0.00}", Eval("ORDER_OFFERAMT"))%>'></asp:TextBox>--%>
                                <asp:Label ID="lblOfferAMT" runat="server" Text='<%#  String.Format("{0:0.00}", Eval("ORDER_OFFERAMT"))%>'></asp:Label>
                            </td>
                            <td class="zt5">
                                发票抬头：

                            </td>
                            <td>
                                <asp:Label ID="Label1" runat="server" ForeColor="Red" Text='<%# Eval("ORDER_INVTITLE")%>'></asp:Label>
                            </td>
                            <td class="zt5">
                                实际金额：

                            </td>
                            <td>
                                <%#  String.Format("{0:0.00}", Eval("ORDER_AAMT"))%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                备注：

                            </td>
                            <td colspan="5">
                                <%# Eval("ORDER_NOTE")%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                详细地址：

                            </td>
                            <td colspan="5">
                                <%# Eval("orderProvince")%>
                                &nbsp;<%# Eval("orderCity")%>&nbsp;<%# Eval("orderArea")%>&nbsp;<%# Eval("ORDER_GETADDRESS")%>
                            </td>
                        </tr>
                        <tr class="z2">
                            <td class="zt5">
                                总数量：
                            </td>
                            <td colspan="5" style="color: Red;">
                                <b><%#  String.Format("{0:0}",Eval("ORDER_QTY"))%></b>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>
            </div>
                        <div class="menu_bg3"><span class="jiacu">商品明细</span>
            </div>
            <div class="juli"><asp:GridView ID="grvInvoiceDetail"  DataKeyNames="OD_DETAILID" runat="server" AutoGenerateColumns="False" OnRowDeleting="grvInvoiceDetail_RowDeleting" CellPadding="0" BorderWidth="0px" Width="1050px" OnRowDataBound="grvInvoiceDetail_RowDataBound">
                <Columns>
                    <asp:TemplateField >
                        <ItemTemplate>
                            <table width="1150" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="60" align="center" class="bk_left">
                                        <asp:Button ID="btnDelete" runat="server" CommandName="Delete" CssClass="input_button" Text="删除" CommandArgument='<%# Eval("OD_DETAILID")%>'/>
                                    </td>
                                    
                                    <td width="190" align="center" class="bk_middle">
                                        <%# Eval("SPMC")%>
                                    </td>
                                    <td width="100" align="center" class="bk_middle">
                                        <%# Eval("OD_CMDCODE")%>
                                    </td>
                                    <td width="40" align="center" class="bk_middle">
                                        <%# Eval("COLOR")%>
                                    </td>
                                    <td width="60" align="center" class="bk_middle">
                                        <%# Eval("SIZE")%>
                                    </td>
                                    <td width="40" align="center" class="bk_middle">
                                        <asp:TextBox ID="txtQty" CssClass="kuandu" name="qty" runat="server" Text='<%#  String.Format("{0:0}",Eval("OD_QTY"))%>'></asp:TextBox>
                                    </td>
                                    <td width="70" align="right" class="bk_middle">
                                        <%#  String.Format("{0:0.00}",Eval("OD_SPRICE"))%>
                                    </td>
                                    <td width="40" align="right" class="bk_middle">
                                        <%#  String.Format("{0:0.00}",Eval("OD_DISC"))%>
                                    </td>
                                    <td width="70" align="right" class="bk_middle">
                                        <%#  String.Format("{0:0.00}",Eval("OD_APRICE"))%>
                                    </td>
                                    <td width="70" align="right" class="bk_middle">
                                        <%#  String.Format("{0:0.00}",Eval("OD_SAMT"))%>
                                    </td>
                                    <td width="70" align="right" class="bk_middle">
                                       <%-- <asp:TextBox ID="txtAmount" CssClass="kuandu1" runat="server" Text='<%#  String.Format("{0:0.00}",Eval("OD_AAMT"))%>'></asp:TextBox>--%>
                                       <%#  String.Format("{0:0.00}",Eval("OD_AAMT"))%>
                                    </td>
                                    <td width="70" align="center" class="bk_middle">
                                        <asp:TextBox ID="txtPoints" CssClass="kuandu1" runat="server" Text='<%# String.Format("{0:0.00}",Eval("Points"))%>'></asp:TextBox>
                                    </td>
                                    <td width="70" align="center" class="bk_middle">
                                        <asp:TextBox ID="txtWeight" CssClass="kuandu1" runat="server" Text='<%# String.Format("{0:0.00}",Eval("Weight"))%>'></asp:TextBox>
                                    </td>
                                    <td align="center" class="bk_middle">
                                        <asp:TextBox ID="txtNotes" runat="server" Text='<%# Eval("OD_NOTE")%>'></asp:TextBox>
                                    </td>
                            </table>
                        </ItemTemplate>
                        <HeaderTemplate>
                            <table width="1150" class="tb1" border="0" cellspacing="1" cellpadding="0">
                                <tr class="z1">
                                    <td width="60" align="center">
                                        删除
                                    </td>
                                    
                                    <td width="190" align="center">
                                        商品名称
                                    </td>
                                    <td width="100" align="center">
                                        款式代码
                                    </td>
                                    <td width="40" align="center">
                                        颜色
                                    </td>
                                    <td width="60" align="center">
                                        尺码
                                    </td>
                                    <td width="40" align="center">
                                        数量
                                    </td>
                                    <td width="70" align="center">
                                        标准单价
                                    </td>
                                    <td width="40" align="center">
                                        折扣
                                    </td>
                                    <td width="70" align="center">
                                        实际单价
                                    </td>
                                    <td width="70" align="center">
                                        标准金额
                                    </td>
                                    <td width="70" align="center">
                                        实际金额
                                    </td>
                                    <td width="70" align="center">
                                        使用积分
                                    </td>
                                    <td width="70" align="center">
                                        重量
                                    </td>
                                    <td align="center">
                                        备注
                                    </td>
                                </tr>
                            </table>
                        </HeaderTemplate>
                        <ItemStyle BorderWidth="0px" />
                        <HeaderStyle BorderWidth="0px" />
                        <FooterStyle BorderWidth="0px" />
                    </asp:TemplateField>
                    
                </Columns>
            </asp:GridView></div>
                        <div class="menu_bg3"><span class="jiacu">意见详细信息</span>&nbsp;<asp:Button ID="btnAddSuggestion" CssClass="input_button" runat="server" Text="意见" OnClick="btnAddSuggestion_Click" /></div>
                <div class="juli"><uc1:ORDERNOTEListControl ID="ORDERNOTEListControl1" runat="server" />
                </div>
                <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
        <cc1:ModalPopupExtender runat="server" ID="programmaticModalPopup"
            PopupControlID="programmaticPopup"
            BackgroundCssClass="modalBackground"
            TargetControlID="hiddenTargetControlForModalPopup">
        </cc1:ModalPopupExtender>
        <asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" style="display:none;width:350px;padding:10px">
            <asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move;background-color:#fef3bb;border:solid 1px #cf994b;color:Black;text-align:center; line-height:22px; font-weight:600;">
                发货中，请稍候...
            </asp:Panel>
            <div style="text-align:center; margin-top:10px;">
            </div>  
        </asp:Panel>
                </div>
            <div id="div_background" class="divbackground">
            </div>
    </form>
</body>
</html>
